package com.huitone.smspfm.interfacz.model;

import java.util.List;

import com.huitone.smspfm.interfacz.logger.ExtLogger;

import com.bin.common.utils.StringUtils;

/**   
* @Title SmsDeliver.java 
* @Package com.huitone.smspfm.interfacz.model 
* @Description TODO(用一句话描述该文件做什么) 
* @author ybliang   
* @date 2017年7月6日 下午5:36:28 
* @version V1.0   
*/
public class SmsDeliverForResend extends SmsDeliver {
	
	private static final ExtLogger logger = ExtLogger.create(SmsDeliverForResend.class);

	// 以下部分重发短信用到start
	private int sendTimes = 0;
	private Long lastSerialPart1 = null;
	private Long lastSerialPart2 = null;
	private Long lastSerialPart3 = null;
	// 以下部分重发短信用到end
	
	public static SmsDeliverForResend parse(List<String> list) {
		
		SmsDeliverForResend deliver = new SmsDeliverForResend();
		
		try {
			
			String str = StringUtils.toString(list.get(7));
			
			deliver.setMoDealListEl(str);
			
			deliver.setSrvNode(StringUtils.toString(list.get(0)));
			deliver.setPhoneNumber(StringUtils.toString(list.get(1)));
			deliver.setSendPort(StringUtils.toString(list.get(2)));
			deliver.setSmcontent(StringUtils.toString(list.get(3)));
			deliver.setRecvTime(StringUtils.toString(list.get(4)));
			deliver.setSerialSegment(StringUtils.toString(list.get(5)));
			deliver.setOrgSrvNode(StringUtils.toString(list.get(6)));
			
			if (!StringUtils.isEmpty(str)) {
				String[] strings = str.split(":");
				deliver.setLastSerialPart1(StringUtils.toLongP(strings[2], 0));
				deliver.setLastSerialPart2(StringUtils.toLongP(strings[3], 0));
				deliver.setLastSerialPart3(StringUtils.toLongP(strings[4], 0));
				deliver.setSendTimes(StringUtils.strToInteger(strings[5], 0));
			}
			
		} catch (Exception e) {
			logger.error("上行短信解析异常", e);
		}
		
		return deliver;
	}
	
	public int getSendTimes() {
		return sendTimes;
	}

	public void setSendTimes(int sendTimes) {
		this.sendTimes = sendTimes;
	}

	public Long getLastSerialPart1() {
		return lastSerialPart1;
	}

	public void setLastSerialPart1(Long lastSerialPart1) {
		this.lastSerialPart1 = lastSerialPart1;
	}

	public Long getLastSerialPart2() {
		return lastSerialPart2;
	}

	public void setLastSerialPart2(Long lastSerialPart2) {
		this.lastSerialPart2 = lastSerialPart2;
	}

	public Long getLastSerialPart3() {
		return lastSerialPart3;
	}

	public void setLastSerialPart3(Long lastSerialPart3) {
		this.lastSerialPart3 = lastSerialPart3;
	}
	
}
